package com.deep.spring.v13.handler;

import java.util.concurrent.TimeUnit;

import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Order(Ordered.HIGHEST_PRECEDENCE)
//@Order(Ordered.LOWEST_PRECEDENCE)
@RestControllerAdvice
public class Handler1 {
    public Handler1() throws InterruptedException {
        TimeUnit.SECONDS.sleep(2);
        System.out.println("handler1 注入 ioc ....");
    }

    @ExceptionHandler(NullPointerException.class)
    private String catche() {
        log.warn("handler1 调用");
        return "handler1";
    }
}
